// src/app.controller.ts

import {
  Controller,
  Post,
  Body,
  UsePipes,
  ValidationPipe,
} from '@nestjs/common';
import { UtilsService } from './utils/utils.service';

@Controller('api')
export class AppController {
  constructor(private readonly utilsService: UtilsService) {}

  @Post('test')
  @UsePipes(new ValidationPipe()) // 使用ValidationPipe进行参数校验
  test(@Body() body: { num: number }): number {
    const { num } = body;
    return this.utilsService.double(num);
  }
}
